package com.nbjtjc.safe.api.safe;

import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.safe.RiskPoint;
import com.nbjtjc.safe.service.safe.RiskPointServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/safe/riskPoint")
@CrossOrigin("*")
public class RiskPointController {

    @Autowired
    private RiskPointServiceImpl riskPointService;


    @PostMapping("add")
    public Result add(@RequestBody RiskPoint riskPoint) {
        return riskPointService.add(riskPoint);
    }

    @PostMapping("delete")
    public Result delete(@RequestBody  RiskPoint riskPoint) {
        return riskPointService.delete(riskPoint);
    }

    @PostMapping("deleteBatch")
    public Result deleteBatch(@RequestBody List<Integer> riskPointIds){
        return riskPointService.deleteBatch(riskPointIds);
    }
    @PostMapping("update")
    public Result update(@RequestBody RiskPoint riskPoint) {
        return riskPointService.update(riskPoint);
    }

    @PostMapping("find")
    public Result find(@RequestBody  RiskPoint riskPoint) {
        return riskPointService.find(riskPoint);
    }

    @PostMapping("insertDatabase")
    public Result insertSysDatabase(@RequestBody RiskPoint riskPoint){
        return riskPointService.insertSysDatabase(riskPoint.getId());
    }

    @PostMapping("copyRiskPointFromSys")
    public Result copyRiskPointFromSys(@RequestBody Map<String, Object> params) {
        Result result = new Result();
        result = riskPointService.copyRiskPointFromSys(params);
        return result;
    }
}
